package cn.drenal.capcap.entity;

import cn.drenal.capcap.entity.base.BaseEntity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tangzc.autotable.annotation.ColumnComment;
import com.tangzc.autotable.annotation.ColumnDefault;
import com.tangzc.autotable.annotation.ColumnNotNull;
import com.tangzc.mpe.annotation.InsertFillTime;
import com.tangzc.mpe.annotation.InsertUpdateFillTime;
import com.tangzc.mpe.autotable.annotation.*;
import com.tangzc.mpe.processer.annotation.AutoDefine;
import com.tangzc.mpe.processer.annotation.AutoMapper;
import com.tangzc.mpe.processer.annotation.AutoRepository;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;

/**
 * 活动表
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Table(comment = "活动表")
public class Activity extends BaseEntity {
    @ColumnComment("主键")
    @ColumnId(mode = IdType.AUTO)
    private Long id;

    @ColumnComment("活动名称")
    @ColumnNotNull
    private String name;

    @ColumnComment("分类ID")
    @ColumnNotNull
    private Long categoryId;

    @ColumnComment("活动封面")
    private String coverImage;

    @ColumnComment("活动描述")
    @Column(length = 1000)
    private String description;

    @ColumnComment("活动规则")
    @Column(length = 2000)
    private String rules;

    @ColumnComment("开始时间")
    @ColumnNotNull
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime startTime;

    @ColumnComment("结束时间")
    @ColumnNotNull
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime endTime;

    @ColumnComment("状态：0-投稿期，1-公示期，2-投票期")
    @ColumnNotNull
    @ColumnDefault("0")
    private Integer status;

    @ColumnComment("浏览量")
    @ColumnNotNull
    @ColumnDefault("0")
    private Integer viewCount;
}